All Questions
Tagged with javaprogramming-challenge
632 questions
4votes
1answer
83views
Efficient way to win points in chocolate bowl game
I'm working on an optimization problem involving a turn-based chocolate-sharing game, and I need help optimizing my current brute-force solution. Problem Description: You and your friend take turns ...
5votes
3answers
959views
LeetCode 678: Valid Parenthesis String, Recursion memoization to DP
How can the following recursion + memoization code be converted into a tabulation format dynamic programming solution? The code is working, but I want to improve it. The challenge I am facing is ...
3votes
1answer
237views
Leetcode: Number of Islands - BFS (Queue vs Recursion)
I was playing around with leetcode's Number of Islands. As per the challenge's description: Given an m x n 2D binary grid grid which represents a map of '1's (land) and '0's (water), return the ...
9votes
2answers
613views
Advent of code 2023 day 5 in Java: mapping integer ranges to new integer ranges
Context I'll be passing an interview coding test in java soon. I am experienced with other programming languages but am very unfamiliar with Java. I am looking for critiques of the coding style much ...
6votes
3answers
465views
Leetcode: Largest Number
I was trying out leetcode's Largest Number. As per the challenge's description: Given a list of non-negative integers nums, arrange them such that they form the largest number and return it. Since ...
4votes
2answers
513views
Leetcode: Steps to Make Array Non-decreasing
I was trying out leetcode's Steps to Make Array Non-decreasing As per the challenge's description: You are given a 0-indexed integer array nums. In one step, remove all elements nums[i] where nums[i ...
9votes
4answers
2kviews
Leetcode : First Missing Positive
I was trying out leetcode's first missing positive. As per the challenge's description: Given an unsorted integer array nums, return the smallest missing positive integer. You must implement an ...
1vote
0answers
23views
Determine top t values with few calls to order(), a given procedure to order k values, Java take 2
My 2nd take of the problem in Determine top t values with few calls to order(), a given procedure to order k values: Given an array and a procedure to order \$k\$ ...
4votes
4answers
184views
Determine top t values with few calls to order(), a given procedure to order k values
I tried to write a decent answer to Most efficient way to get the largest 3 elements of an array using no comparisons but a procedure for ordering 5 elements descendantly. I could not come up with ...
0votes
1answer
314views
HackerRank "Digit sum" challenge
Here's the question: ...
2votes
3answers
553views
Recursive palindrome check
I'm trying to solve this which basically calls for a recursive palindrome check with some minor extra steps (Special characters and whitespace can be ignored). The test inputs' length can be 100000 ...
2votes
1answer
190views
An evolutionary algorithm written in Java to crack an XOR cipher
Alright. So TryHackme is a website that tries to teach hacking with hands on labs. They have a room called JVM Reverse Engineering where the user gets to reverse engineer Java apps, and in particular ...
1vote
2answers
414views
Coin Change in Java
Inspired by a leetcode exercise, I wrote my own coin changer: You are given an integer array coins representing coins of different denominations and an integer amount representing a total amount of ...
4votes
2answers
98views
Partition List in 2 parts
I came up with the following code while trying to solve the Leetcode partition list problem Though my solution is accepted, I am not happy with a few of the additional variables which I am creating. ...
4votes
3answers
4kviews
Split word based on terms from an array
I was faced with a coding challenge and I'm looking for a more elegant way to achieve the goal. The challenge Take the word baseball from the first item in the string array and split it into two ...